package me.itsoo.artemis.framework.repository.exception;

import me.itsoo.artemis.framework.core.util.StringUtils;

/**
 * CreatedConnectionException
 *
 * @author zxy
 * @version 0.0.1
 * @since 2023/5/19
 */
public class CreatedConnectionException extends RuntimeException {

    private static final long serialVersionUID = 2676367063524300789L;

    private final String errorMsg;

    public CreatedConnectionException(int coreSize, int maxSize) {
        this.errorMsg = StringUtils.format("Connection pool is full, 'coreSize': {}, 'maxSize': {}", coreSize, maxSize);
    }

    public CreatedConnectionException(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    @Override
    public String getMessage() {
        return this.errorMsg;
    }

    @Override
    public synchronized Throwable fillInStackTrace() {
        return this;
    }
}
